Skip to content

Make caps.Capability non-experimental #23507

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

natsukagami
Copy link
Contributor

Closes #22745.

Make scala.caps.Capability non-experimental.

The Capability trait can be used as a marker trait even outside of capture-checking.
Only when capture checking is enabled, the trait carries a special meaning, marking each instance a top-level capability.

Other definitions inside the scala.caps package (the package is already non-experimental) stays experimental
and can only be used with -experimental or with capture-checking enabled (with an import or with the feature flag).

@odersky odersky added the needs-minor-release This PR cannot be merged until the next minor release label Jul 11, 2025
@odersky
Copy link
Contributor

odersky commented Jul 25, 2025

We also need to make SharedCapability (and maybe Control) non-experimental, since Label will extend it.

@natsukagami natsukagami force-pushed the make-capability-stable branch from 01849f0 to 72ced26 Compare July 31, 2025 14:23
@natsukagami natsukagami requested a review from a team as a code owner July 31, 2025 14:23
@tgodzik tgodzik force-pushed the make-capability-stable branch from 72ced26 to be436ce Compare August 4, 2025 09:18
@@ -24,14 +24,12 @@ import annotation.{experimental, compileTimeOnly, retainsCap}
*
* Capability has exactly two subtraits: Shared and Exclusive.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's at least make the scaladocs with @experimental or mention it, so that people are aware that there is still a scenario that this might be deprecated.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tgodzik I think we are ready to commit to that now. That is, if capture checking becomes standard at one time then we plan to have these traits defined. The doc page is waiting to be merged here: https://github.com/scala/scala3/blob/3658d3da98eb0c5ed33c74ec6402562330bf9ed8/docs/_docs/reference/experimental/capture-checking/classifiers.md

If capture checking does not make it into the standard, the whole caps package would be deprecated and dropped. So in a sense it does not matter which traits are exposed in there.

An alternative would be to bend the rules so that we make boundary.Label non-experimental even though it would extend experimental traits, which is usually not allowed. I am not sure that would address the concerns with inlining though. @natsukagami can you comment on this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's fine I think. I was mostly hoping to mention in some place that this is not something people should use unless they are experimenting with CC

@natsukagami natsukagami force-pushed the make-capability-stable branch from a402cf3 to 0ad0244 Compare August 12, 2025 02:27
@odersky
Copy link
Contributor

odersky commented Aug 12, 2025

@tgodzik Good point. We should mention that these traits make sense only for capture checking, which is experimental.

@odersky
Copy link
Contributor

odersky commented Aug 12, 2025

@natsukagami Let's add a note to this effect in the doc comments of all affected traits.

@natsukagami
Copy link
Contributor Author

I updated the doc-comments to mention experimental capture checking on all traits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-minor-release This PR cannot be merged until the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Drop @experimental for scala.caps.Capability
3 participants